package com.example.jasonrpc.client.simple;

import com.example.jasonrpc.client.ClientConfig;
import com.example.jasonrpc.codec.JSONDecoder;
import com.example.jasonrpc.codec.JSONEncoder;
import com.example.jasonrpc.proto.Peer;
import com.example.jasonrpc.registry.RegistryDirectory;
import com.example.jasonrpc.transport.HttpTransportClient;

import java.util.List;

public class RpcClientConfig extends ClientConfig {

    public RpcClientConfig(String serverIp, int serverPort) {
        this.transportClientClass = HttpTransportClient.class;
        this.encoderClass = JSONEncoder.class;
        this.decoderClass = JSONDecoder.class;
        this.selectorClass = RandomTransportSelector.class;
        this.connectCount = 1;
        this.directories = List.of(new RegistryDirectory(List.of(new Peer(serverIp, serverPort))));
    }
}
